<?php $this->load('upload_header')?>
<?php if ($ispost): ?>
	
	<?php
	if ($errmsg) {
		echo $errmsg;
	} else {
		foreach ($files as $file) {
			if ($file['err']) {
				printf('<li>%s --- <span style="color:red">%s</span></li>', $file['name'], $file['errmsg']);
			} else {
				printf('<li>');
				if ($file['isimage']) {
					printf('<a href="javascript:;" onclick=\'to_editor("content","%s")\'>%s</a> ', addcslashes('<p><img src="'.$file['path'].'" alt="'.$file['name'].'" /></p>','"'), __('[插入HTML]'));
					printf('<a href="javascript:;" onclick=\'to_editor("content","[img=%d,%d][upload=%d][/img]")\'>%s</a> ', $file['width'], $file['height'], $file['fileid'], __('[插入UBB]'));
				} else {
					printf('<a href="javascript:;" onclick=\'to_editor("content","%s")\'>%s</a> ', addcslashes('<a href="'.$file['path'].'" title="'.$file['name'].'">'.$file['name'].'</a>','"'), __('[插入HTML]'));
					printf('<a href="javascript:;" onclick=\'to_editor("content","[file][upload=%d][/file]")\'>%s</a> ', $file['fileid'], __('[插入UBB]'));
				}
				printf('%s --- <span style="color:green">%s</span></li>', $file['name'], __('成功'));
			}
		}
	}
	?>
	
<?php else: ?>
<form name="upload" method="post" action="<?php echo URL('upload.upload')?>" enctype="multipart/form-data">
	<input type="hidden" name="postid" value="<?echo $postid?>" />
	<input type="hidden" name="dosubmit" value="yes" />
	<p><input type="file" name="attach[]" /></p>
	<p><input type="file" name="attach[]" /></p>
	<p><input type="file" name="attach[]" /></p>
	<p><input type="submit" class="button" value=" 上 传 " /></p>
</form>
<?php endif; ?>
<?php $this->load('upload_footer')?>